home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJINC106.ARJ / GENERIC.H < prev    next >
C/C++ Source or Header  |  1992-03-29  |  2KB  |  55 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. #ifndef generic_h
  20. #define generic_h 1
  21.  
  22. /*
  23.  *    See the CPP manual, argument prescan section for explanation
  24.  */
  25.  
  26. #define name2(a,b) gEnErIc2(a,b)
  27. #define gEnErIc2(a,b) a ## b
  28.  
  29. #define name3(a,b,c) gEnErIc3(a,b,c)
  30. #define gEnErIc3(a,b,c) a ## b ## c
  31.  
  32. #define name4(a,b,c,d) gEnErIc4(a,b,c,d)
  33. #define gEnErIc4(a,b,c,d) a ## b ## c ## d
  34.  
  35. #define GENERIC_STRING(a) gEnErIcStRiNg(a)
  36. #define gEnErIcStRiNg(a) #a
  37.  
  38. #define declare(clas,t)        name2(clas,declare)(t)
  39. #define declare2(clas,t1,t2)   name2(clas,declare2)(t1,t2)
  40.  
  41. #define implement(clas,t)      name2(clas,implement)(t)
  42. #define implement2(clas,t1,t2) name2(clas,implement2)(t1,t2)
  43.  
  44. extern genericerror(int,char*);
  45. typedef int (*GPT)(int,char*);
  46.  
  47. #define set_handler(gen,type,x) name4(set_,type,gen,_handler)(x)
  48.  
  49. #define errorhandler(gen,type)  name3(type,gen,handler)
  50.  
  51. #define callerror(gen,type,a,b) (*errorhandler(gen,type))(a,b)
  52.  
  53.  
  54. #endif generic_h
  55.